"use strict";
cc._RF.push(module, '140e620Z7NG9aligqOqmuBh', 'addEngry');
// Script/addEngry.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var gameNetWorkState_1 = require("./SdkTools/gameNetWorkState");
var gameShareAdsVideo_1 = require("./SdkTools/gameShareAdsVideo");
var storage_1 = require("./SdkTools/storage");
var TopUi_1 = require("./TopUi");
/**s
 * 增加体力s
 */
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var addEngry = /** @class */ (function (_super) {
    __extends(addEngry, _super);
    function addEngry() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.note = null;
        _this.kuang = null;
        _this.closenode = null;
        _this.topuisc = null;
        return _this;
        // update (dt) {}
    }
    // LIFE-CYCLE CALLBACKS:
    addEngry.prototype.onLoad = function () {
        this.showUi();
        //Storage.Instance.nowEnery>=Define.maxEnery?this.note.string = '体力值已满，无需增加':this.note.string = '立即增加5点体力值' 
    };
    addEngry.prototype.onEnable = function () {
        gameShareAdsVideo_1.default.Instance.bannerAds_Show();
        gameShareAdsVideo_1.default.Instance.chaPingAds_Show();
        if (gameNetWorkState_1.default.Instance.getOpenState_Video()) {
            cc.find('ling', this.kuang).active = !1;
            cc.find('shuang', this.kuang).active = !0;
        }
        else {
            cc.find('ling', this.kuang).active = !0;
            cc.find('shuang', this.kuang).active = !1;
        }
    };
    addEngry.prototype.onDisable = function () {
        gameShareAdsVideo_1.default.Instance.bannerAds_Hide();
    };
    addEngry.prototype.showUi = function () {
        var self = this;
        this.kuang.scale = 0.3;
        cc.tween(this.kuang)
            .to(0.1, { scale: 1 })
            .start();
        this.closenode.active = !1;
        cc.tween(this.closenode)
            .delay(2)
            .call(function () {
            self.closenode.active = !0;
        })
            .start();
    };
    addEngry.prototype.setTopUiSc = function () {
        console.log('++++++++++');
        var sc = cc.find('Canvas/top').getComponent(TopUi_1.default);
        if (sc) {
            this.topuisc = sc;
        }
        // let over = cc.find('Canvas/GameOver/top')
        // if(over){
        //     let sc2 = over.getComponent(TopUi)
        //     if(sc2){
        //         this.topuisc = sc2
        //     }
        // }
    };
    addEngry.prototype.addBtnClick = function () {
        var self = this;
        gameShareAdsVideo_1.default.Instance.motivational_Video_Show(function () {
            storage_1.default.Instance.setEnergy(storage_1.default.Instance.nowEnery + 1);
            if (self.topuisc) {
                self.topuisc.setTiLi();
            }
            self.closeBtnClick();
        }, function () { });
    };
    addEngry.prototype.addBtnClick2 = function () {
        var self = this;
        gameShareAdsVideo_1.default.Instance.motivational_Video_Show(function () {
            storage_1.default.Instance.setEnergy(storage_1.default.Instance.nowEnery + 10);
            if (self.topuisc) {
                self.topuisc.setTiLi();
            }
            self.closeBtnClick();
        }, function () { });
    };
    addEngry.prototype.closeBtnClick = function () {
        this.node.removeFromParent(true);
    };
    addEngry.prototype.start = function () {
    };
    __decorate([
        property(cc.Label)
    ], addEngry.prototype, "note", void 0);
    __decorate([
        property(cc.Node)
    ], addEngry.prototype, "kuang", void 0);
    __decorate([
        property(cc.Node)
    ], addEngry.prototype, "closenode", void 0);
    addEngry = __decorate([
        ccclass
    ], addEngry);
    return addEngry;
}(cc.Component));
exports.default = addEngry;

cc._RF.pop();